import * as React from 'react';
import Tag from '../tag'
import './styles.less'

export interface HeaderProps {
  list: string[];
  onSelectTag: Function
}

export default class Header extends React.Component<HeaderProps> {
  selectTag = item => {
    this.props.onSelectTag(item)
  }
  render() {
    const {
      list = []
    } = this.props;

    return (
      <div className="com-tag-container">
        {list.map((item, index) => (
          <div key={index} className="" onClick={() => this.selectTag(item)}>
            <Tag title={item}/>
          </div>
        ))}
      </div>
    );
  }
}
